import request from 'utils/requset'
/**
 * 获取文章列表
 * @param {*} params
 * @returns
 */
export const getArticles = (params) => {
  return request({
    url: '/mp/articles',
    params,
  })
}

export const delArticles = (id) => {
  return request({
    url: `mp/articles/${id}`,
    method: 'DELETE',
  })
}

export const addArticles = (data, draft = false) => {
  return request({
    url: `mp/articles?draft=${draft}`,
    method: 'POST',
    data,
  })
}

export const getArticlesById = (id) => {
  return request({
    url: `mp/articles/${id}`,
  })
}

export const updateArticles = (data, draft = false) => {
  return request({
    url: `mp/articles/${data.id}?draft=${draft}`,
    method: 'PUT',
    data,
  })
}
